##import os
##os.system("start https://www.lanqiao.cn/problems/8147/learning/")

n, a, b = input().split()

n = int(n)
a = int(a, n)
b = int(b, n)

print(a * b)
